<script>
export default {
    data() {
        return {
            tab_bg: '',
            active_tab: 'home'
        }
    },
    computed: {
        list() {
            return this.$store.state.tabBarData;
        }
    },
    methods: {
        changeTab(type) {
            this.active_tab = type;
            this.$router.push({ name: type });
        }
    }
}
</script>
<template>
    <div class="tab-bar-wrap">
        <div class="tab-bar-item" v-for="(item,$index) in list" :key="$index">
            <div class="tab-bar-box" @click="changeTab(item.type)">
                <image class="icon" :src="active_tab !== item.type?item.icon_normal:item.icon_selected"></image>
                <text class="txt" :style="{color:active_tab !== item.type?item.text_color_normal:item.text_color_selected}">{{item.name}}</text>
            </div>
        </div>
    </div>
</template>
<style scoped>
.tab-bar-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: row;
    justify-content: space-around;
    background-color: #fff;
}

.tab-bar-box {
    align-items: center;
    padding-top: 20px;
    padding-bottom: 10px;
}

.icon {
    width: 45px;
    height: 45px;
}

.txt {
    font-size: 25px;
}
</style>
